1. Field of the Invention
The present invention relates generally to an improved data processing system, and in particular, to a computer implemented method for managing data processing systems. Still more particularly, the present invention relates to a computer implemented method, system, and computer usable program code for on-demand monitoring of memory usage by an application in a data processing system.
2. Description of the Related Art
Software applications executing in a data processing system use memory associated with that data processing system. For example, an application uses the memory for storing instructions needed to execute the application's intended functions, data needed by those instructions, results of computations, and temporary information relevant to the execution of the application.
Generally, applications do not reserve all the memory space at once the application anticipates using over the course of the application's execution. Applications request and reserve an amount of memory when they have a need for the memory space. This process of requesting and reserving an amount of memory space is called memory allocation. Generally, a memory management system in the data processing system allocates memory space to a requesting application. The memory management system is generally a memory management functional unit of the operating system operating the data processing system.
Once an application does not need an allocated memory space, the application frees the memory space. The memory management system then deallocates the freed memory space for use by other applications. The process of deallocating memory in this manner is called memory deallocation.
Ideally, an application should eventually free all the memory that was allocated to the application. However, many applications fail to free some segments of memory spaces that are allocated to the application at some time in their execution. Failing to free memory that was allocated to an application and that the application does not need anymore is called a memory leak. Memory leak is an undesirable characteristic in an application, and software designers take great pains to ensure that the application does not have a memory leak problem.
Memory leak in an application executing on a data processing system can deteriorate the overall performance of the data processing system over time. In such cases, the memory management system allocates an amount of memory space to the application, and the application frees only a part of that memory. Over a period of time, this cycle of allocating memory and freeing less than the amount that was allocated causes a net reduction in memory resources that are available for allocating to other applications in the data processing system. The reduction in memory resources causes applications to perform slower, degrading the overall performance of the data processing system.